<template>
	<view>
		<!-- 我的下级  顶部 -->
		<view class="subordinate_box">
			<view class="today_invite">
				<text class="num">{{info.todayChildCount}}</text>
				<text>今日邀请</text>
			</view>
			<view class="history_invite">
				<text class="num">{{info.beforeTodayChildCount}}</text>
				<text>历史邀请</text>
			</view>
		</view>
		<!-- @click="subordinate_detail(item.u_id)" -->
		<!-- 下级列表 -->
		<view class="subordinate_list"  v-for="(item,index) in Subordinate_list" :key="index">
			<view class="subordinate_cont">
				<image :src="item.u_avatar" mode=""></image>
				<view class="subordinate_name">
					<text class="name">{{item.u_nickname}}</text>
					<text>已消费：¥{{item.balance_cost}}</text>
				</view>
				<view class="right">
				<!-- 	<image src="https://wanchuyun-img.oss-cn-beijing.aliyuncs.com/guomai/afad2666520a5d4b4757a8aff8db2dc7996ffe1a.png" mode=""></image> -->
				</view>
			</view>
		</view>
		
		<view class="no_box" v-if="Subordinate_list.length == 0">
			<image src="https://wanchuyun-img.oss-cn-beijing.aliyuncs.com/guomai/c5ffa53ec8059a251ad3fdb50f56d6f827e1b42e.png" mode=""></image>
		</view>
	</view>
</template>

<script>
	const app = getApp()
	export default {
		data() {
			return {
				Subordinate_list: '',
				info: ''
			};
		},
		onLoad() {
			this.getSubordinate()
		},
		methods:{
			// 下级消费情况
			subordinate_detail(id){
				uni.navigateTo({
					url: '/pages/user/my_subordinate_detail/my_subordinate_detail?child_id=' + id
				})
			},
			
			// 下级列表
			getSubordinate(){
				let that = this;
				app.globalRequest({
					api: app.getApi().user.TeamCenter,
				}).then(res => {
					if (res.code == 1) {
						that.Subordinate_list = res.data.childList
						that.info = res.data
					}
				}).catch(err => {
				
				})
			},
			
		}
	}
</script>

<style lang="scss">
	.subordinate_box{
		width: 90%;
		margin: 30rpx auto 20rpx;
		background-color: #fff;
		padding: 50rpx 0;
		box-sizing: border-box;
		display: flex;
		align-items: center;
		.today_invite,.history_invite{
			display: flex;
			flex-direction: column;
			align-items: center;
			justify-content: center;
			width: 50%;
			border-right: 2rpx solid #EEEEEE;
			text{
				font-size: 28rpx;
			}
			.num{
				font-size: 40rpx;
				color: #333;
				margin-bottom: 10rpx;
			}
		}
		.history_invite{
			border: 0;
		}
	}
	
	.subordinate_list{
		width: 90%;
		margin: 30rpx auto 0;
		background-color: #fff;
		.subordinate_cont{
			display: flex;
			align-items: center;
			justify-content: space-between;
			padding: 38rpx 20rpx;
			box-sizing: border-box;
			image{
				width: 64rpx;
				height: 64rpx;
				border-radius: 50%;
			}
			.subordinate_name{
				display: flex;
				flex-direction: column;
				width: 75%;
				text{
					font-size: 24rpx;
					color: #666;
				}
				.name{
					color: #333333;
					font-size: 28rpx;
					margin-bottom: 10rpx;
				}
			}
			.right{
				width: 40rpx;
				height: 40rpx;
				image{
					width: 100%;
					height: 100%;
				}
			}
		}
	}
	.no_box{
		width: 520rpx;
		height: 430rpx;
		margin: 400rpx auto;
		image{
			width: 100%;
			height: 100%;
		}
	}
</style>
